home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / apps / 284 / applic / txtool.doc < prev    next >
Text File  |  1988-08-18  |  10KB  |  304 lines

  1. *************************************************************
  2.  
  3.     TxTool, a Utility for Word Processing            
  4.  
  5.       (c) 1988 by    Don E. Farmer
  6.             16810 Deer Creek Dr.
  7.             Spring, TX 77379
  8.  
  9.     This is SHAREWARE and may not be sold by anyone.
  10.  
  11.     PLEASE DONATE $5.00 FOR THIS PROGRAM.
  12.  
  13. **************************************************************
  14.  
  15.  
  16.      TxTool is a GEM application for the Atari ST.  It is a 
  17.  
  18. utility program that was designed to be used as an adjunct to a 
  19.  
  20. word processor.  Using it will increase your word processing 
  21.  
  22. power.
  23.  
  24.      TxTool computes word counts, checks spelling, reports
  25.  
  26. questionable usage of English, and does search-and-replace's 
  27.  
  28. that are specified by a file.  Except for word counts, TxTool 
  29.  
  30. requires the use of auxiliary files, which are termed 
  31.  
  32. "dictionaries."  These, you build with your word processor.  How 
  33.  
  34. powerful TxTool is for you depends largely on the effort you put 
  35.  
  36. into tailoring these dictionaries to meet your needs.  (I have 
  37.  
  38. included some of the dictionaries I use in this arc.  Please note
  39.  
  40. that the spelling dictionary is only a start.  You may wish to 
  41.  
  42. purchase one from Austin Code Works, rather than making your own.)
  43.  
  44.      When this GEM application is opened, the menu bar displays
  45.  
  46. "Desk", "File", "Options", and "Help."  Under "Help" are the
  47.  
  48. selections "General", "Counts", "Spell", "Usage", and "StrSub."
  49.  
  50. Selecting these leads to dialog boxes that serve to remind you 
  51.  
  52. how to operate TxTool.  They cannot take the place of the 
  53.  
  54. information provided here.
  55.  
  56.      In its general operation, TxTool reads an input text file, 
  57.  
  58. which should be ASCII for reliable results, along with the 
  59.  
  60. appropriate dictionary, and then writes its results to an output 
  61.  
  62. file.  The option, "Counts" requires no dictionary.  In all cases
  63.  
  64. the input text and the dictionary are not altered when TxTool is
  65.  
  66. run.  An option to mouse usage is also provided for.  By typing 
  67.  
  68. the key combination "Control I", for example, the File Selector
  69.  
  70. is displayed for the path name of the input stream.  The key 
  71.  
  72. combinations are displayed along with what they select in the
  73.  
  74. menu, the character "^" designating "Control."  Using the key 
  75.  
  76. strokes is faster but not easier than using the mouse.
  77.  
  78.      The counts that TxTool does are of words, sentences, words
  79.  
  80. per sentence, and word frequency, this being an alphabetized list
  81.  
  82. of every word used in the input text along with the number of its
  83.  
  84. occurrences.  The algorithm to do this comes from a slight 
  85.  
  86. modification of one given in Kernighan & Ritchie's, The C 
  87.  
  88. Programming Language, as does the binary search function used in 
  89.  
  90. the spelling checker.
  91.  
  92.      A "word" is a string, no longer than 32 characters, of ASCII 
  93.  
  94. letters; the punctuation marks, apostrophe and hyphen, are also 
  95.  
  96. included.  A sentence is of at most 512 characters and is a string
  97.  
  98. of words terminated by a period, a question, or an exclamation 
  99.  
  100. mark.  This punctuation is necessary, for TxTool processes 
  101.  
  102. sentences, not lines, and will not work without it.  The number 
  103.  
  104. of words and sentences is often useful.  The distribution of words
  105.  
  106. per sentence can indicate how much variety in sentence length
  107.  
  108. there is.  And, with the word frequency list, the overuse of a
  109.  
  110. particular word is easily spotted.  Also, this list can be loaded
  111.  
  112. into a word processor and edited to add to a spelling dictionary.
  113.  
  114.      The spelling dictionary is an ASCII file containing a list of
  115.  
  116. alphabetized words, one word of at most 32 characters for each 
  117.  
  118. line in the file.  The words should have neither leading nor 
  119.  
  120. trailing spaces nor anything embedded in it that is not a letter,
  121.  
  122. an apostrophe, or a hyphen.  This dictionary is alphabetized in 
  123.  
  124. ASCII order.  If you are building a "SPELL.DIC" and are using a 
  125.  
  126. line sort that allows "dictionary order", do not use it!  Use the 
  127.  
  128. standard ASCII sort instead.  The spelling checker is not sensitive 
  129.  
  130. to case, and apostrophes are significant, being considered to be 
  131.  
  132. letter and a part of the word that they are in.  The checker does 
  133.  
  134. a binary search of the dictionary for each word in the input text,
  135.  
  136. writing the words it does not find to the output file.  You do not
  137.  
  138. have to listen to a chorus of dings nor tire your trigger finger 
  139.  
  140. clicking repeatedly on "OK."  You can load the results of the 
  141.  
  142. spelling checker into your word processor, edit it, and then let 
  143.  
  144. "StrSub" make the corrections for you.  The checker's search is 
  145.  
  146. efficient, particularly so since no data compaction or pointer 
  147.  
  148. hashing is done.  (Isn't cheap memory wonderful?)
  149.  
  150.      To determine the number of words the spelling dictionary can 
  151.  
  152. hold requires you to know how much free ram remains when the 
  153.  
  154. program is executing.  One fourth of this ram is allotted to 
  155.  
  156. pointers to the entries while the other three fourth's hold the 
  157.  
  158. actual text.  Suppose, for example, it is known that 400K of ram 
  159.  
  160. was free when TxTool was resident and had freed the heap, that is,
  161.  
  162. the memory available for dynamic allocation.  Then 100K would be 
  163.  
  164. taken up by pointers, and since a pointer requires four bytes, 
  165.  
  166. this would mean that the spelling dictionary could hold at most 
  167.  
  168. 25K words.  (Although there are about 500K words in the English 
  169.  
  170. language, it is said that the average person uses less than 10K.  
  171.  
  172. I'm sure the owner of an ST uses more!)  You can approximate the 
  173.  
  174. heap by summing the size of TXTOOL.PRG, TXTOOL.RSC, 32K (TxTool 
  175.  
  176. takes this for its stack.), and your desk accessories, and then 
  177.  
  178. subtracting this from your memory size.  Doing this, I must 
  179.  
  180. emphasize, is only an approximation, for we are dependent on the 
  181.  
  182. gemdos allocator Malloc(), which has been know to have its quirks.
  183.  
  184.      A usage dictionary will help you to avoid mistakes in idiom 
  185.  
  186. such as using "off of" for "off" and "over with" for "over."  It 
  187.  
  188. will help you to avoid trite and redundant expressions such as 
  189.  
  190. "neither rhyme nor reason" and "a smile on his face."  (Where but 
  191.  
  192. a face would a smile be?)  There can be 7000 lines in a usage 
  193.  
  194. dictionary, each entry taking two lines, and no line being longer 
  195.  
  196. than 64 characters.  The first line might be "a smile on his face" 
  197.  
  198. and the second, the report "REDUNDANT."  For each sentence in the 
  199.  
  200. input text, TxTool searches the target lines in the usage 
  201.  
  202. dictionary for a match.  When a match is made, the line following 
  203.  
  204. the target is included in the report that is written to the output 
  205.  
  206. file.  The target line allows the character '?' to serve as a wild 
  207.  
  208. card character in the searches.  Thus, "h??" could be either "him" 
  209.  
  210. or "her."
  211.  
  212.      I have found it convenient to have a number of usage
  213.  
  214. dictionaries, "IDIOM.DIC", "TRITE.DIC", "WORDY.DIC", for example, 
  215.  
  216. and name my output files "*.IDM", "*.TRI", and "*.WOR."  This is 
  217.  
  218. just a suggestion, however, as TxTool allows you to name your files 
  219.  
  220. anything you wish.  Two warnings are in order.  First, the 
  221.  
  222. dictionary search is necessarily linear so if you have 3500 trite 
  223.  
  224. expressions, and there might well be that many, then you might want 
  225.  
  226. to go for a nice long walk because searching each sentence of your 
  227.  
  228. input 3500 times will take a while.  Second, and I suppose there 
  229.  
  230. is some humor in this, working with trite expressions is like 
  231.  
  232. being around the plague: you're apt to catch it!  You find yourself 
  233.  
  234. using ones you had never heard of until you starting searching for 
  235.  
  236. them in Fowler's Modern English Usage.  The ones new to you sound 
  237.  
  238. pretty good; that is why, of course, they got worn out so readily.
  239.  
  240.      The dictionary for string substitution, "StrSub", also has two
  241.  
  242. lines for each entry, each no longer than 64 characters.  The first
  243.  
  244. line, again, is a target string; but the second is the replacement
  245.  
  246. text.  When the target is matched in the input file, the replacement
  247.  
  248. text is substituted for it.  Again, the input text is searched
  249.  
  250. linearly, and only once in each sentence is a target string replaced.
  251.  
  252. For example, let's say you wanted to replace your "cats" with "dogs"
  253.  
  254. in your text.  Your dictionary entry would read:
  255.  
  256.          cats
  257.          dogs
  258.  
  259.     and if your input text was:
  260.  
  261.     Cats cats cats.
  262.  
  263.     Your output would be:
  264.  
  265.     Cats dogs cats.
  266.  
  267. The first "Cats" is not replaced because of case sensitivity and 
  268.  
  269. the latter because of only one replacement per sentence.  In 
  270.  
  271. practice this is not much of a restriction as you can "bucket 
  272.  
  273. brigade" your files for multiple passes.  You can use StrSub as a
  274.  
  275. gender changer for him's to her's, he's to she's, etc, if you are
  276.  
  277. writing reports concerning specific male and females "persons."
  278.  
  279.      Most of the constraints mentioned so far are manifest 
  280.  
  281. constants in the C source code and can be changed should you 
  282.  
  283. compiled it again.  I used MegaMax's Lazer C, but see no reason 
  284.  
  285. why it could not be compiled with another C.  Making other changes 
  286.  
  287. to the source code is not recommended unless you are an experienced 
  288.  
  289. C programmer.  THE C SOURCE CODE IS AVAILABLE FROM ME FOR $15.00.
  290.  
  291. Getting good dictionaries together is where your efforts will be rewarded.
  292.  
  293.      Writing is hard work.  Trying to come up with the right words 
  294.  
  295. at the right time is chore enough without worrying about your 
  296.  
  297. "off of"'s and "acid test"'s.  With TxTool to assist you, this 
  298.  
  299. editing can be done in advance and need be done only once.  Then 
  300.  
  301. you can allow the muse to flow freely.  But do watch out for those 
  302.  
  303. "aching voids" and "blushing brides!"
  304.